android-activity

Activity automatically scrolls to the middle

Deadly 提交于 2020-01-23 01:35:08
问题 When i open an activity it automatically scrolls to the middle..When i open the fragment which has same layout xml file that the activity has it opens fine without scrolling.. I tried putting View view=getWindow().getDecorView().findViewById(android.R.id.content); view.scrollTo(0,0); but it doesn't worked.. Why my activity automatically scrolls to middle and how can i adjust it so that it opens without scrolling? public class TeamDetails extends FragmentActivity { ImageView iv1, iv2, iv3;

Full screen transparent activity (no title & status bar) doesn't work… why?

孤街浪徒 提交于 2020-01-22 17:32:50
问题 I'm making a custom lock screen. The lock screen is an activity which I launch by the time the screen goes off. However, I can't make the activity be both transparent & fullscreen. The Status bar keeps showing. Here's what I do in the manifest: <activity android:name=".activities.LockScreenActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/> I'm also adding these extras in activit's onCreate: requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout

Full screen transparent activity (no title & status bar) doesn't work… why?

杀马特。学长 韩版系。学妹 提交于 2020-01-22 17:32:06
问题 I'm making a custom lock screen. The lock screen is an activity which I launch by the time the screen goes off. However, I can't make the activity be both transparent & fullscreen. The Status bar keeps showing. Here's what I do in the manifest: <activity android:name=".activities.LockScreenActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/> I'm also adding these extras in activit's onCreate: requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout

inside Android Dialog, how to setup onActivityResult for startActivityForResult?

霸气de小男生 提交于 2020-01-22 17:15:09
问题 From an activity, I can easily setup the onActivityResult() and call startActivityForResult() and everything works fine. Now, I need to call startActivityForResult() from the Dialog. But I can't setup the onActivityResult() , I believe Dialog is not an Activity . How do I get the result? I try something like this inside a dialog but it failed. //create new Intent Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, m_PicUri); ((Activity)

How to parse Retrofit JSON response

匆匆过客 提交于 2020-01-22 17:08:40
问题 I have a typical Retrofit API request: RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint(URL) .build(); ApiEndpointInterface api = restAdapter.create(ApiEndpointInterface.class); api.getToken('1', new Callback<DefaultResponse>() { @Override public void success(DefaultResponse json, Response response) { // } @Override public void failure(RetrofitError response) { // } }); And the returned JSON is: {"success":true,"data":{"token_id":"pPt9AKl0Cg","token_key":"8ax224sFrJZZkStAQuER"

How to parse Retrofit JSON response

纵饮孤独 提交于 2020-01-22 17:08:10
问题 I have a typical Retrofit API request: RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint(URL) .build(); ApiEndpointInterface api = restAdapter.create(ApiEndpointInterface.class); api.getToken('1', new Callback<DefaultResponse>() { @Override public void success(DefaultResponse json, Response response) { // } @Override public void failure(RetrofitError response) { // } }); And the returned JSON is: {"success":true,"data":{"token_id":"pPt9AKl0Cg","token_key":"8ax224sFrJZZkStAQuER"

Distinguish between pushing “home” button and opening another Activity

◇◆丶佛笑我妖孽 提交于 2020-01-22 14:52:09
问题 I have three activity: - SplashActivity - MainActivity - PlayerActivity Of course the app starts with SplashActivity, then it starts MainActivity and closes. MainActivity in some moment starts PlayerActivity and goes to backstack. (MainActivity is alive but is onStop) Then I need open MainActivity and set PlayerActivity to background (PlayerActivity is alive but is onStop). Then I need open PlayerActivity again and set MainActivity to background. So PlayerActivity and MainActivity often gets

Distinguish between pushing “home” button and opening another Activity

戏子无情 提交于 2020-01-22 14:51:46
问题 I have three activity: - SplashActivity - MainActivity - PlayerActivity Of course the app starts with SplashActivity, then it starts MainActivity and closes. MainActivity in some moment starts PlayerActivity and goes to backstack. (MainActivity is alive but is onStop) Then I need open MainActivity and set PlayerActivity to background (PlayerActivity is alive but is onStop). Then I need open PlayerActivity again and set MainActivity to background. So PlayerActivity and MainActivity often gets

Finishing all activities started before the activity

为君一笑 提交于 2020-01-22 12:32:07
问题 I want to finish all the activities which are running in the application means want to remove all the parent activities from stack. I want to implement logout functionality locally in my application so what I was thinking, I will finish all the activities started before and will start login activity again.. 回答1: I should let you know this is not a recommended behavior in android since you should let itself to manage life circles of activities. However if you really need to do this, you can

Finishing all activities started before the activity

微笑、不失礼 提交于 2020-01-22 12:31:49
问题 I want to finish all the activities which are running in the application means want to remove all the parent activities from stack. I want to implement logout functionality locally in my application so what I was thinking, I will finish all the activities started before and will start login activity again.. 回答1: I should let you know this is not a recommended behavior in android since you should let itself to manage life circles of activities. However if you really need to do this, you can