How to create your own Android Library and publish it
open a new project, file, new, new module, select : android library, name it : somethinglibrary add desired classes to said module in the java folder. uplaod the project folder to github (see git hub walkthrough https://www.yotamarker.com/t176p25-ios-app-dev?highlight=github#514 )
on github in said repo : click releases, publish release. open jitpack.io, Insert your repository address (repoAccountName)/libraryname, lookup, get it.
from the results : copy paste : maven {url 'https://jitpack.io'} to the gradle.build of the project in repositories which is in allprojects
and copy paste the dependency(the one with compile) in gradle.build of the app in dependencies{}
_________________ MB over and out
Last edited by Moti Barski on Sat Feb 06, 2021 7:22 pm; edited 1 time in total
kurosen codding
Posts : 291 Join date : 2012-04-17
Subject: android studio toggle black screen time out Thu Mar 05, 2020 2:14 am
toggle screen timeout :
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); or getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); to disable the screen timeout and getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); to re-enable it.
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType){ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_layout,parent,false); ViewHolder viewHolder = new ViewHolder(view); return viewHolder; }
public void onBindViewHolder(RecyclerView.ViewHolder holder,int position){ // Get Device Name and Device Address DeviceInfoModel deviceInfoModel = (DeviceInfoModel) deviceList.get(position); String deviceName = deviceInfoModel.getDeviceName(); final String deviceAddress = deviceInfoModel.getDeviceHardwareAddress();
// Assign Device name to the list ViewHolder itemHolder = (ViewHolder) holder; itemHolder.textName.setText(deviceName);
// Return to Main Screen when a device is selected // And pass device Address information to create connection itemHolder.textName.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(context, MainActivity.class); intent.putExtra("deviceAddress",deviceAddress); context.startActivity(intent); } });
}
public int getItemCount(){ int dataCount = deviceList.size(); return dataCount; }
}
code to summon the activity with the recycler view (put this code in your MainActivity) :
Intent intent = new Intent(MainActivity.this, SelectDeviceActivity.class); startActivity(intent);
get selectet device chosen : deviceAddress = getIntent().getStringExtra("deviceAddress"); if (deviceAddress != null){}//handle choiced result here
_________________ MB over and out
Last edited by Moti Barski on Sat Feb 06, 2021 7:23 pm; edited 1 time in total
Moti Barski super
Posts : 499 Join date : 2011-08-02
Subject: Re: android mobile app development grimoire Sat Feb 06, 2021 6:39 pm